/// <summary>
        /// Gets user personal data if he entered email and password correctly.
        /// </summary>
        /// <param name="email"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public static FrontendUserModel GetUserByLoginInfo(string email, string password)
        {
            SqlConnection connection = new SqlConnection(DataConnections.OwnerUAconnectionString);

            connection.Open();

            // user data to return
            FrontendUserModel user = null;


            SqlCommand getUserByLoginInfoCommand = new SqlCommand("dbo.Users_GetUserByEmail", connection);

            getUserByLoginInfoCommand.CommandType = System.Data.CommandType.StoredProcedure;
            getUserByLoginInfoCommand.Parameters.AddWithValue("@Email", email);


            SqlDataReader userDataReader = getUserByLoginInfoCommand.ExecuteReader();

            // if there is user with such email and his password correct then creating new user entity
            while (userDataReader.Read() && BCryptHashing.IsPasswordValid(password, (string)userDataReader[5]))
            {
                user = new FrontendUserModel
                {
                    FirstName = (string)userDataReader[1],
                    LastName  = (string)userDataReader[2],
                    Phone     = (string)userDataReader[3],
                    Email     = (string)userDataReader[4]
                };
            }

            userDataReader.Close();

            connection.Close();


            return(user);
        }